﻿@using RGA.Models
@model IList<RGA.Models.Shipment>
@{
    var options = new AjaxOptions();
    options.HttpMethod = "POST";
    options.Confirm = "Do you wish to submit this form?";
    options.OnBegin = "OnBegin";
    options.OnComplete = "OnComplete";
    options.OnFailure = "OnFailure";
    options.OnSuccess = "OnSuccess";
    options.LoadingElementDuration = 1000;
    options.UpdateTargetId = "divResponse";
    options.InsertionMode = InsertionMode.InsertAfter;
}

@* ReSharper disable once ForCanBeConvertedToForeach *@
@*for(int i=0;i<Model.Count;i++)
{
    @Html.EditorFor(mod => Model[i], "Shipment")
}*@
<div id="editableItems">
    @foreach (Shipment shipment in Model)
    {
        Html.RenderPartial("EditorTemplates/Shipment", shipment);
    }
</div>
<div id="items"></div>

@Ajax.ActionLink("Dodaj", "AddAddress", "Routes", new AjaxOptions
{
    UpdateTargetId = "editableItems",
    InsertionMode = InsertionMode.InsertAfter,
    OnSuccess = "addGeocomplete()"
}, new {@class = "btn btn-default"})
@*<div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <input type="submit" value="Dodaj" class="btn btn-default" />
        </div>
    </div>*@